/**
 * 商品模块路由文件
 */

const Router = require('koa-router');
const router = new Router();
const { validate } = require('../validators/common');
const { add, update, changeStatus, search } = require('../services/goods');
const { validAdd, validUpdate, validChangeStatus, validSearch } = require('../validators/goods');
const { authorization } = require('./common');

router.prefix('/goods');

router.post('/add', authorization('goodsAdd'), validate(validAdd), add);

router.put('/update', authorization('goodsUpdate'), validate(validUpdate), update);

router.get('/search', authorization('goodsSearch'), validate(validSearch), search);

router.put('/changeStatus', authorization('goodsChangeStatus'), validate(validChangeStatus), changeStatus);

module.exports = router;